package com.cvs.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
 
import com.cvs.services.ChmService;


@Controller
public class HomeController {

	@Autowired
	private ChmService controllerService;
	
	public ChmService getControllerService() {
		return controllerService;
	}

	public void setControllerService(ChmService controllerService) {
		this.controllerService = controllerService;
	}

	@RequestMapping(value="home/{name}", method = RequestMethod.GET)
	public String getMovie(@PathVariable String name, ModelMap model) {
 
		model.addAttribute("user", name);
		model.addAttribute("message", "out");
		
		controllerService.createUserRecord(name,"password", name);
		return "list";
	}
}
